Add env section to bundle scripts for DABs interpolation#5299
Open
shreyas-goenka wants to merge 6 commits into
Open
Add env section to bundle scripts for DABs interpolation#5299shreyas-goenka wants to merge 6 commits into
shreyas-goenka wants to merge 6 commits into
Conversation
932c672 to
0452148
Compare
Collaborator
Integration test reportCommit: a32d68c
9 interesting tests: 4 RECOVERED, 4 SKIP, 1 flaky
Top 10 slowest tests (at least 2 minutes):
|
f373d61 to
b68897d
Compare
scripts.<name> now accepts an env: map whose values may reference
${bundle.*}, ${workspace.*}, and ${var.*}. The script content is still
passed to the shell as-is (no DABs interpolation), removing the ambiguity
between bundle variables and shell variables that previously forced all
${...} usage to be rejected.
When an env value references an unsupported prefix (e.g. ${resources.*}),
validation reports a clear error pointing at the field. The content-side
error now suggests the new env section instead of just stating ${...} is
unsupported.
Fixes #4179
Co-authored-by: Isaac
b68897d to
8044e34
Compare
Resolved conflicts in NEXT_CHANGELOG.md (kept both entry sets) and bundle/internal/schema/annotations.yml (took main's regenerated layout, re-added the scripts env field annotation). Co-authored-by: Isaac
denik
reviewed
Jul 6, 2026
denik
reviewed
Jul 6, 2026
Fix the earlier bad merge in NEXT_CHANGELOG.md: the prior merge resurrected Bundles entries that had already been swept into the v1.6.0 release. Reset the changelog to origin/main and re-added only the scripts env entry. Co-authored-by: Isaac
| PLACEHOLDER | ||
| "env": | ||
| "description": |- | ||
| PLACEHOLDER |
Contributor
There was a problem hiding this comment.
please add a description here so it shows up in tooltips via the jsonschema
Contributor
Author
There was a problem hiding this comment.
Done — added a description for scripts.<name>.env in annotations.yml (regenerated jsonschema.json).
Comment on lines
+281
to
+286
| env := scriptEnv(cmd, b) | ||
| // Append after the auth/target variables so a script's env: section takes | ||
| // precedence on collision (os/exec uses the last value for a duplicate key). | ||
| for _, name := range slices.Sorted(maps.Keys(script.Env)) { | ||
| env = append(env, name+"="+script.Env[name]) | ||
| } |
Contributor
There was a problem hiding this comment.
add an acceptance test for this
Contributor
Author
There was a problem hiding this comment.
Added the env-precedence acceptance test: a script's env: entry sets DATABRICKS_BUNDLE_TARGET=from-script-env and the output confirms it wins over the CLI-injected value.
| @@ -0,0 +1 @@ | |||
| errcode trace $CLI bundle validate | |||
Contributor
There was a problem hiding this comment.
Suggested change
| errcode trace $CLI bundle validate | |
| musterr trace $CLI bundle validate |
Contributor
Author
There was a problem hiding this comment.
Applied musterr (dropped the redundant errcode).
- Add a real description for scripts.<name>.env in annotations.yml so it surfaces in jsonschema tooltips (regenerated jsonschema.json). - Use musterr instead of errcode in the env-bad-prefix script to assert the command must fail. - Add an env-precedence acceptance test proving a script's env: entry overrides a CLI-injected variable (DATABRICKS_BUNDLE_TARGET). Co-authored-by: Isaac
v1.8.0 was cut, emptying the Bundles section of NEXT_CHANGELOG.md on main. Kept only the scripts env entry. Co-authored-by: Isaac
janniklasrose
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4179.
Adds an
env:map toscripts.<name>. Values may reference${bundle.*},${workspace.*}, and${var.*}; they're resolved before the script runs and exported into its shell, wherecontentuses plain$NAME:contentis still passed to the shell as-is, so${...}incontentstays unsupported (the error now points to theenv:section). Env values with any other prefix (e.g.${resources.*}) are rejected. On a name collision with the CLI-injected auth vars, the script'senv:wins.This pull request was AI-assisted by Isaac.